package com.neusoft.his.sys.entity;

import java.util.List;

public class CommonResult<T> {
	private int status = 200;
	private String msg = "OK";
	private T data;

	public CommonResult() {

	}

	public CommonResult(T data) {
		this.data = data;
	}

	public int getStatus() {
		return status;
	}
/**  统一编写代码，实现状态码和描述信息一致
 * 
 * @param status
 */
	public void setStatus(int status) {
		this.status = status;
		switch (this.status) {
		case 250:
			this.msg="执行删改操作成功，但是影响记录行数为零";
			break;
		case 202:
			this.msg="创建资源成功！";
			break;
		case 203:
			this.msg="修改资源成功！";
			break;
		case 404:
			this.msg="请求的资源不存在！";
			break;
		case 403:
			this.msg="当前资源权限受限，请登录！";       
			break;
		default:
			break;
		}
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}
	
	public static CommonResult ret403() {
		CommonResult result = new CommonResult();
		result.setStatus(403);
		return result;
	}

}
